Integrand size = 23, antiderivative size = 76 \[ \int \frac {\sin ^2(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {(a+2 b) x}{2 a^2}-\frac {\sqrt {b} \sqrt {a+b} \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{a^2 f}-\frac {\cos (e+f x) \sin (e+f x)}{2 a f} \]
1/2*(a+2*b)*x/a^2-1/2*cos(f*x+e)*sin(f*x+e)/a/f-arctan(b^(1/2)*tan(f*x+e)/ (a+b)^(1/2))*b^(1/2)*(a+b)^(1/2)/a^2/f
Result contains complex when optimal does not.
Time = 0.61 (sec) , antiderivative size = 245, normalized size of antiderivative = 3.22 \[ \int \frac {\sin ^2(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {(a+2 b+a \cos (2 (e+f x))) \sec ^2(e+f x) \left (\frac {\arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{\sqrt {b} \sqrt {a+b} f}-\frac {-4 (a+2 b) x-\frac {\left (a^2+8 a b+8 b^2\right ) \arctan \left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (-((a+2 b) \sin (f x))+a \sin (2 e+f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (\cos (2 e)-i \sin (2 e))}{\sqrt {a+b} f \sqrt {b (\cos (e)-i \sin (e))^4}}+\frac {2 a \cos (2 f x) \sin (2 e)}{f}+\frac {2 a \cos (2 e) \sin (2 f x)}{f}}{a^2}\right )}{16 \left (a+b \sec ^2(e+f x)\right )} \]
((a + 2*b + a*Cos[2*(e + f*x)])*Sec[e + f*x]^2*(ArcTan[(Sqrt[b]*Tan[e + f* x])/Sqrt[a + b]]/(Sqrt[b]*Sqrt[a + b]*f) - (-4*(a + 2*b)*x - ((a^2 + 8*a*b + 8*b^2)*ArcTan[(Sec[f*x]*(Cos[2*e] - I*Sin[2*e])*(-((a + 2*b)*Sin[f*x]) + a*Sin[2*e + f*x]))/(2*Sqrt[a + b]*Sqrt[b*(Cos[e] - I*Sin[e])^4])]*(Cos[2 *e] - I*Sin[2*e]))/(Sqrt[a + b]*f*Sqrt[b*(Cos[e] - I*Sin[e])^4]) + (2*a*Co s[2*f*x]*Sin[2*e])/f + (2*a*Cos[2*e]*Sin[2*f*x])/f)/a^2))/(16*(a + b*Sec[e + f*x]^2))
Time = 0.27 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.20, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3042, 4620, 373, 397, 216, 218}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\sin ^2(e+f x)}{a+b \sec ^2(e+f x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sin (e+f x)^2}{a+b \sec (e+f x)^2}dx\) |
\(\Big \downarrow \) 4620 |
\(\displaystyle \frac {\int \frac {\tan ^2(e+f x)}{\left (\tan ^2(e+f x)+1\right )^2 \left (b \tan ^2(e+f x)+a+b\right )}d\tan (e+f x)}{f}\) |
\(\Big \downarrow \) 373 |
\(\displaystyle \frac {\frac {\int \frac {-b \tan ^2(e+f x)+a+b}{\left (\tan ^2(e+f x)+1\right ) \left (b \tan ^2(e+f x)+a+b\right )}d\tan (e+f x)}{2 a}-\frac {\tan (e+f x)}{2 a \left (\tan ^2(e+f x)+1\right )}}{f}\) |
\(\Big \downarrow \) 397 |
\(\displaystyle \frac {\frac {\frac {(a+2 b) \int \frac {1}{\tan ^2(e+f x)+1}d\tan (e+f x)}{a}-\frac {2 b (a+b) \int \frac {1}{b \tan ^2(e+f x)+a+b}d\tan (e+f x)}{a}}{2 a}-\frac {\tan (e+f x)}{2 a \left (\tan ^2(e+f x)+1\right )}}{f}\) |
\(\Big \downarrow \) 216 |
\(\displaystyle \frac {\frac {\frac {(a+2 b) \arctan (\tan (e+f x))}{a}-\frac {2 b (a+b) \int \frac {1}{b \tan ^2(e+f x)+a+b}d\tan (e+f x)}{a}}{2 a}-\frac {\tan (e+f x)}{2 a \left (\tan ^2(e+f x)+1\right )}}{f}\) |
\(\Big \downarrow \) 218 |
\(\displaystyle \frac {\frac {\frac {(a+2 b) \arctan (\tan (e+f x))}{a}-\frac {2 \sqrt {b} \sqrt {a+b} \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{a}}{2 a}-\frac {\tan (e+f x)}{2 a \left (\tan ^2(e+f x)+1\right )}}{f}\) |
((((a + 2*b)*ArcTan[Tan[e + f*x]])/a - (2*Sqrt[b]*Sqrt[a + b]*ArcTan[(Sqrt [b]*Tan[e + f*x])/Sqrt[a + b]])/a)/(2*a) - Tan[e + f*x]/(2*a*(1 + Tan[e + f*x]^2)))/f
3.1.36.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a , 0] || GtQ[b, 0])
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_ ), x_Symbol] :> Simp[e*(e*x)^(m - 1)*(a + b*x^2)^(p + 1)*((c + d*x^2)^(q + 1)/(2*(b*c - a*d)*(p + 1))), x] - Simp[e^2/(2*(b*c - a*d)*(p + 1)) Int[(e *x)^(m - 2)*(a + b*x^2)^(p + 1)*(c + d*x^2)^q*Simp[c*(m - 1) + d*(m + 2*p + 2*q + 3)*x^2, x], x], x] /; FreeQ[{a, b, c, d, e, q}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] && GtQ[m, 1] && LeQ[m, 3] && IntBinomialQ[a, b, c, d, e, m, 2, p, q, x]
Int[((e_) + (f_.)*(x_)^2)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_ Symbol] :> Simp[(b*e - a*f)/(b*c - a*d) Int[1/(a + b*x^2), x], x] - Simp[ (d*e - c*f)/(b*c - a*d) Int[1/(c + d*x^2), x], x] /; FreeQ[{a, b, c, d, e , f}, x]
Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*sin[(e_.) + (f_.)*(x_ )]^(m_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Simp[ff^(m + 1)/f Subst[Int[x^m*(ExpandToSum[a + b*(1 + ff^2*x^2)^(n/2), x]^p/(1 + f f^2*x^2)^(m/2 + 1)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[m/2] && IntegerQ[n/2]
Time = 0.57 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.03
method | result | size |
derivativedivides | \(\frac {-\frac {\left (a +b \right ) b \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a^{2} \sqrt {\left (a +b \right ) b}}+\frac {-\frac {a \tan \left (f x +e \right )}{2 \left (1+\tan \left (f x +e \right )^{2}\right )}+\frac {\left (a +2 b \right ) \arctan \left (\tan \left (f x +e \right )\right )}{2}}{a^{2}}}{f}\) | \(78\) |
default | \(\frac {-\frac {\left (a +b \right ) b \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a^{2} \sqrt {\left (a +b \right ) b}}+\frac {-\frac {a \tan \left (f x +e \right )}{2 \left (1+\tan \left (f x +e \right )^{2}\right )}+\frac {\left (a +2 b \right ) \arctan \left (\tan \left (f x +e \right )\right )}{2}}{a^{2}}}{f}\) | \(78\) |
risch | \(\frac {x}{2 a}+\frac {x b}{a^{2}}+\frac {i {\mathrm e}^{2 i \left (f x +e \right )}}{8 a f}-\frac {i {\mathrm e}^{-2 i \left (f x +e \right )}}{8 a f}-\frac {\sqrt {-a b -b^{2}}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-a b -b^{2}}-a -2 b}{a}\right )}{2 f \,a^{2}}+\frac {\sqrt {-a b -b^{2}}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-a b -b^{2}}+a +2 b}{a}\right )}{2 f \,a^{2}}\) | \(163\) |
1/f*(-(a+b)*b/a^2/((a+b)*b)^(1/2)*arctan(b*tan(f*x+e)/((a+b)*b)^(1/2))+1/a ^2*(-1/2*a*tan(f*x+e)/(1+tan(f*x+e)^2)+1/2*(a+2*b)*arctan(tan(f*x+e))))
Time = 0.28 (sec) , antiderivative size = 257, normalized size of antiderivative = 3.38 \[ \int \frac {\sin ^2(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\left [\frac {2 \, {\left (a + 2 \, b\right )} f x - 2 \, a \cos \left (f x + e\right ) \sin \left (f x + e\right ) + \sqrt {-a b - b^{2}} \log \left (\frac {{\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + 4 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 4 \, {\left ({\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{3} - b \cos \left (f x + e\right )\right )} \sqrt {-a b - b^{2}} \sin \left (f x + e\right ) + b^{2}}{a^{2} \cos \left (f x + e\right )^{4} + 2 \, a b \cos \left (f x + e\right )^{2} + b^{2}}\right )}{4 \, a^{2} f}, \frac {{\left (a + 2 \, b\right )} f x - a \cos \left (f x + e\right ) \sin \left (f x + e\right ) + \sqrt {a b + b^{2}} \arctan \left (\frac {{\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{2} - b}{2 \, \sqrt {a b + b^{2}} \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right )}{2 \, a^{2} f}\right ] \]
[1/4*(2*(a + 2*b)*f*x - 2*a*cos(f*x + e)*sin(f*x + e) + sqrt(-a*b - b^2)*l og(((a^2 + 8*a*b + 8*b^2)*cos(f*x + e)^4 - 2*(3*a*b + 4*b^2)*cos(f*x + e)^ 2 + 4*((a + 2*b)*cos(f*x + e)^3 - b*cos(f*x + e))*sqrt(-a*b - b^2)*sin(f*x + e) + b^2)/(a^2*cos(f*x + e)^4 + 2*a*b*cos(f*x + e)^2 + b^2)))/(a^2*f), 1/2*((a + 2*b)*f*x - a*cos(f*x + e)*sin(f*x + e) + sqrt(a*b + b^2)*arctan( 1/2*((a + 2*b)*cos(f*x + e)^2 - b)/(sqrt(a*b + b^2)*cos(f*x + e)*sin(f*x + e))))/(a^2*f)]
\[ \int \frac {\sin ^2(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\int \frac {\sin ^{2}{\left (e + f x \right )}}{a + b \sec ^{2}{\left (e + f x \right )}}\, dx \]
Time = 0.26 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.01 \[ \int \frac {\sin ^2(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {\frac {{\left (f x + e\right )} {\left (a + 2 \, b\right )}}{a^{2}} - \frac {\tan \left (f x + e\right )}{a \tan \left (f x + e\right )^{2} + a} - \frac {2 \, {\left (a b + b^{2}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {{\left (a + b\right )} b}}\right )}{\sqrt {{\left (a + b\right )} b} a^{2}}}{2 \, f} \]
1/2*((f*x + e)*(a + 2*b)/a^2 - tan(f*x + e)/(a*tan(f*x + e)^2 + a) - 2*(a* b + b^2)*arctan(b*tan(f*x + e)/sqrt((a + b)*b))/(sqrt((a + b)*b)*a^2))/f
Time = 0.30 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.21 \[ \int \frac {\sin ^2(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {\frac {{\left (f x + e\right )} {\left (a + 2 \, b\right )}}{a^{2}} - \frac {2 \, {\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b + b^{2}}}\right )\right )} \sqrt {a b + b^{2}}}{a^{2}} - \frac {\tan \left (f x + e\right )}{{\left (\tan \left (f x + e\right )^{2} + 1\right )} a}}{2 \, f} \]
1/2*((f*x + e)*(a + 2*b)/a^2 - 2*(pi*floor((f*x + e)/pi + 1/2)*sgn(b) + ar ctan(b*tan(f*x + e)/sqrt(a*b + b^2)))*sqrt(a*b + b^2)/a^2 - tan(f*x + e)/( (tan(f*x + e)^2 + 1)*a))/f
Time = 18.39 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.46 \[ \int \frac {\sin ^2(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {\mathrm {atanh}\left (\frac {\sin \left (e+f\,x\right )\,\sqrt {-b^2-a\,b}}{a\,\cos \left (e+f\,x\right )+b\,\cos \left (e+f\,x\right )}\right )\,\sqrt {-b^2-a\,b}-a\,\left (\frac {\sin \left (2\,e+2\,f\,x\right )}{4}-\frac {\mathrm {atan}\left (\frac {\sin \left (e+f\,x\right )}{\cos \left (e+f\,x\right )}\right )}{2}\right )+b\,\mathrm {atan}\left (\frac {\sin \left (e+f\,x\right )}{\cos \left (e+f\,x\right )}\right )}{a^2\,f} \]